using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using AudioDjStudio;
using IntelliTouchMix;


	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1PL : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label labelVuMeter1;
		private System.Windows.Forms.Button buttonForward1;
		private System.Windows.Forms.Button buttonRewind1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TrackBar trackBarVolume1;
		private System.Windows.Forms.Button buttonPause1;
		private System.Windows.Forms.Button buttonStop1;
		private System.Windows.Forms.Button buttonPlay1;
		private System.Windows.Forms.Label labelVuMeter2;
		private System.Windows.Forms.Button buttonForward2;
		private System.Windows.Forms.Button buttonRewind2;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.TrackBar trackBarVolume2;
		private System.Windows.Forms.Button buttonPause2;
		private System.Windows.Forms.Button buttonStop2;
		private System.Windows.Forms.Button buttonPlay2;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.ListView listViewPlaylist2;
		private System.Windows.Forms.ColumnHeader columnTitle2;
		private System.Windows.Forms.ColumnHeader columnDuration2;
		private System.Windows.Forms.Button buttonLoad2;
		private System.Windows.Forms.Button buttonSave2;
		private System.Windows.Forms.Button buttonAddFile2;
		private System.Windows.Forms.Button buttonRemove2;
		private System.Windows.Forms.Button buttonMoveUp2;
		private System.Windows.Forms.Button buttonMoveDown2;
		private System.Windows.Forms.ColumnHeader columnIndex2;
		private System.Windows.Forms.ListView listViewPlaylist1;
		private System.Windows.Forms.ColumnHeader columnIndex1;
		private System.Windows.Forms.ColumnHeader columnDuration1;
		private System.Windows.Forms.ColumnHeader columnTitle1;
		private System.Windows.Forms.OpenFileDialog openFileDialog1;
		private System.Windows.Forms.Button buttonPrev1;
		private System.Windows.Forms.Button buttonNext1;
		private System.Windows.Forms.Button buttonNext2;
		private System.Windows.Forms.Button buttonPrev2;
		private System.Timers.Timer timer1;
		private System.Windows.Forms.Label labelPosition1;
		private System.Windows.Forms.Label labelPosition2;
		private System.Windows.Forms.Button buttonMoveDown1;
		private System.Windows.Forms.Button buttonMoveUp1;
		private System.Windows.Forms.Button buttonRemove1;
		private System.Windows.Forms.Button buttonAddFile1;
		private System.Windows.Forms.Button buttonSave1;
		private System.Windows.Forms.Button buttonLoad1;
		private System.Windows.Forms.SaveFileDialog saveFileDialog1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		internal	Int16	Player_1 = 0;
		internal	Int16	Player_2 = 1;
		private AudioDjStudio.AudioDjStudio audioDjStudio1;
        private System.Windows.Forms.Label labelLoadingStatus;
		private System.Windows.Forms.ProgressBar progressBarLoading;


        private int sortColumn = -1;

		public Form1PL()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1PL));
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.labelPosition1 = new System.Windows.Forms.Label();
            this.buttonNext1 = new System.Windows.Forms.Button();
            this.buttonPrev1 = new System.Windows.Forms.Button();
            this.buttonMoveDown1 = new System.Windows.Forms.Button();
            this.buttonMoveUp1 = new System.Windows.Forms.Button();
            this.buttonRemove1 = new System.Windows.Forms.Button();
            this.buttonAddFile1 = new System.Windows.Forms.Button();
            this.buttonSave1 = new System.Windows.Forms.Button();
            this.buttonLoad1 = new System.Windows.Forms.Button();
            this.listViewPlaylist1 = new System.Windows.Forms.ListView();
            this.columnIndex1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnDuration1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnTitle1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.labelVuMeter1 = new System.Windows.Forms.Label();
            this.buttonForward1 = new System.Windows.Forms.Button();
            this.buttonRewind1 = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.trackBarVolume1 = new System.Windows.Forms.TrackBar();
            this.buttonPause1 = new System.Windows.Forms.Button();
            this.buttonStop1 = new System.Windows.Forms.Button();
            this.buttonPlay1 = new System.Windows.Forms.Button();
            this.labelVuMeter2 = new System.Windows.Forms.Label();
            this.buttonForward2 = new System.Windows.Forms.Button();
            this.buttonRewind2 = new System.Windows.Forms.Button();
            this.label12 = new System.Windows.Forms.Label();
            this.trackBarVolume2 = new System.Windows.Forms.TrackBar();
            this.buttonPause2 = new System.Windows.Forms.Button();
            this.buttonStop2 = new System.Windows.Forms.Button();
            this.buttonPlay2 = new System.Windows.Forms.Button();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.labelPosition2 = new System.Windows.Forms.Label();
            this.buttonNext2 = new System.Windows.Forms.Button();
            this.buttonPrev2 = new System.Windows.Forms.Button();
            this.buttonMoveDown2 = new System.Windows.Forms.Button();
            this.buttonMoveUp2 = new System.Windows.Forms.Button();
            this.buttonRemove2 = new System.Windows.Forms.Button();
            this.buttonAddFile2 = new System.Windows.Forms.Button();
            this.buttonSave2 = new System.Windows.Forms.Button();
            this.buttonLoad2 = new System.Windows.Forms.Button();
            this.listViewPlaylist2 = new System.Windows.Forms.ListView();
            this.columnIndex2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnDuration2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnTitle2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.timer1 = new System.Timers.Timer();
            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            this.audioDjStudio1 = new AudioDjStudio.AudioDjStudio();
            this.labelLoadingStatus = new System.Windows.Forms.Label();
            this.progressBarLoading = new System.Windows.Forms.ProgressBar();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarVolume1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarVolume2)).BeginInit();
            this.groupBox2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.BackColor = System.Drawing.SystemColors.Control;
            this.groupBox1.Controls.Add(this.labelPosition1);
            this.groupBox1.Controls.Add(this.buttonNext1);
            this.groupBox1.Controls.Add(this.buttonPrev1);
            this.groupBox1.Controls.Add(this.buttonMoveDown1);
            this.groupBox1.Controls.Add(this.buttonMoveUp1);
            this.groupBox1.Controls.Add(this.buttonRemove1);
            this.groupBox1.Controls.Add(this.buttonAddFile1);
            this.groupBox1.Controls.Add(this.buttonSave1);
            this.groupBox1.Controls.Add(this.buttonLoad1);
            this.groupBox1.Controls.Add(this.listViewPlaylist1);
            this.groupBox1.Controls.Add(this.labelVuMeter1);
            this.groupBox1.Controls.Add(this.buttonForward1);
            this.groupBox1.Controls.Add(this.buttonRewind1);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.trackBarVolume1);
            this.groupBox1.Controls.Add(this.buttonPause1);
            this.groupBox1.Controls.Add(this.buttonStop1);
            this.groupBox1.Controls.Add(this.buttonPlay1);
            this.groupBox1.Location = new System.Drawing.Point(8, 8);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(648, 222);
            this.groupBox1.TabIndex = 3;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Playlist for Player 1";
            // 
            // labelPosition1
            // 
            this.labelPosition1.Location = new System.Drawing.Point(152, 192);
            this.labelPosition1.Name = "labelPosition1";
            this.labelPosition1.Size = new System.Drawing.Size(72, 16);
            this.labelPosition1.TabIndex = 85;
            this.labelPosition1.Text = "-";
            this.labelPosition1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // buttonNext1
            // 
            this.buttonNext1.Location = new System.Drawing.Point(618, 192);
            this.buttonNext1.Name = "buttonNext1";
            this.buttonNext1.Size = new System.Drawing.Size(24, 24);
            this.buttonNext1.TabIndex = 84;
            this.buttonNext1.Text = ">";
            this.buttonNext1.Click += new System.EventHandler(this.buttonNext1_Click);
            // 
            // buttonPrev1
            // 
            this.buttonPrev1.Location = new System.Drawing.Point(588, 192);
            this.buttonPrev1.Name = "buttonPrev1";
            this.buttonPrev1.Size = new System.Drawing.Size(24, 24);
            this.buttonPrev1.TabIndex = 83;
            this.buttonPrev1.Text = "<";
            this.buttonPrev1.Click += new System.EventHandler(this.buttonPrev1_Click);
            // 
            // buttonMoveDown1
            // 
            this.buttonMoveDown1.Location = new System.Drawing.Point(432, 16);
            this.buttonMoveDown1.Name = "buttonMoveDown1";
            this.buttonMoveDown1.Size = new System.Drawing.Size(72, 24);
            this.buttonMoveDown1.TabIndex = 82;
            this.buttonMoveDown1.Text = "Move down";
            this.buttonMoveDown1.Click += new System.EventHandler(this.buttonMoveDown1_Click);
            // 
            // buttonMoveUp1
            // 
            this.buttonMoveUp1.Location = new System.Drawing.Point(352, 16);
            this.buttonMoveUp1.Name = "buttonMoveUp1";
            this.buttonMoveUp1.Size = new System.Drawing.Size(72, 24);
            this.buttonMoveUp1.TabIndex = 81;
            this.buttonMoveUp1.Text = "Move up";
            this.buttonMoveUp1.Click += new System.EventHandler(this.buttonMoveUp1_Click);
            // 
            // buttonRemove1
            // 
            this.buttonRemove1.Location = new System.Drawing.Point(272, 16);
            this.buttonRemove1.Name = "buttonRemove1";
            this.buttonRemove1.Size = new System.Drawing.Size(72, 24);
            this.buttonRemove1.TabIndex = 80;
            this.buttonRemove1.Text = "Remove";
            this.buttonRemove1.Click += new System.EventHandler(this.buttonRemove1_Click);
            // 
            // buttonAddFile1
            // 
            this.buttonAddFile1.Location = new System.Drawing.Point(192, 16);
            this.buttonAddFile1.Name = "buttonAddFile1";
            this.buttonAddFile1.Size = new System.Drawing.Size(72, 24);
            this.buttonAddFile1.TabIndex = 79;
            this.buttonAddFile1.Text = "Add song";
            this.buttonAddFile1.Click += new System.EventHandler(this.buttonAddFile1_Click);
            // 
            // buttonSave1
            // 
            this.buttonSave1.Location = new System.Drawing.Point(512, 16);
            this.buttonSave1.Name = "buttonSave1";
            this.buttonSave1.Size = new System.Drawing.Size(72, 24);
            this.buttonSave1.TabIndex = 78;
            this.buttonSave1.Text = "Save";
            this.buttonSave1.Click += new System.EventHandler(this.buttonSave1_Click);
            // 
            // buttonLoad1
            // 
            this.buttonLoad1.Location = new System.Drawing.Point(112, 16);
            this.buttonLoad1.Name = "buttonLoad1";
            this.buttonLoad1.Size = new System.Drawing.Size(72, 24);
            this.buttonLoad1.TabIndex = 77;
            this.buttonLoad1.Text = "Load";
            this.buttonLoad1.Click += new System.EventHandler(this.buttonLoad1_Click);
            // 
            // listViewPlaylist1
            // 
            this.listViewPlaylist1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnIndex1,
            this.columnDuration1,
            this.columnTitle1});
            this.listViewPlaylist1.FullRowSelect = true;
            this.listViewPlaylist1.GridLines = true;
            this.listViewPlaylist1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.listViewPlaylist1.HideSelection = false;
            this.listViewPlaylist1.Location = new System.Drawing.Point(230, 66);
            this.listViewPlaylist1.Name = "listViewPlaylist1";
            this.listViewPlaylist1.Size = new System.Drawing.Size(412, 120);
            this.listViewPlaylist1.TabIndex = 76;
            this.listViewPlaylist1.UseCompatibleStateImageBehavior = false;
            this.listViewPlaylist1.View = System.Windows.Forms.View.Details;
            this.listViewPlaylist1.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewPlaylist1_ColumnClick);
            // 
            // columnIndex1
            // 
            this.columnIndex1.Text = "Index";
            this.columnIndex1.Width = 38;
            // 
            // columnDuration1
            // 
            this.columnDuration1.Text = "Duration";
            this.columnDuration1.Width = 66;
            // 
            // columnTitle1
            // 
            this.columnTitle1.Text = "Title";
            this.columnTitle1.Width = 385;
            // 
            // labelVuMeter1
            // 
            this.labelVuMeter1.BackColor = System.Drawing.Color.Black;
            this.labelVuMeter1.Location = new System.Drawing.Point(70, 66);
            this.labelVuMeter1.Name = "labelVuMeter1";
            this.labelVuMeter1.Size = new System.Drawing.Size(40, 120);
            this.labelVuMeter1.TabIndex = 47;
            this.labelVuMeter1.Click += new System.EventHandler(this.labelVuMeter1_Click);
            // 
            // buttonForward1
            // 
            this.buttonForward1.Location = new System.Drawing.Point(512, 192);
            this.buttonForward1.Name = "buttonForward1";
            this.buttonForward1.Size = new System.Drawing.Size(64, 24);
            this.buttonForward1.TabIndex = 35;
            this.buttonForward1.Text = "Forward";
            this.buttonForward1.Click += new System.EventHandler(this.buttonForward1_Click);
            // 
            // buttonRewind1
            // 
            this.buttonRewind1.Location = new System.Drawing.Point(440, 192);
            this.buttonRewind1.Name = "buttonRewind1";
            this.buttonRewind1.Size = new System.Drawing.Size(64, 24);
            this.buttonRewind1.TabIndex = 34;
            this.buttonRewind1.Text = "Rewind";
            this.buttonRewind1.Click += new System.EventHandler(this.buttonRewind1_Click);
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(8, 32);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(48, 16);
            this.label1.TabIndex = 32;
            this.label1.Text = "Volume";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // trackBarVolume1
            // 
            this.trackBarVolume1.Location = new System.Drawing.Point(8, 66);
            this.trackBarVolume1.Maximum = 100;
            this.trackBarVolume1.Name = "trackBarVolume1";
            this.trackBarVolume1.Orientation = System.Windows.Forms.Orientation.Vertical;
            this.trackBarVolume1.Size = new System.Drawing.Size(45, 120);
            this.trackBarVolume1.TabIndex = 31;
            this.trackBarVolume1.TickFrequency = 10;
            this.trackBarVolume1.TickStyle = System.Windows.Forms.TickStyle.Both;
            this.trackBarVolume1.Scroll += new System.EventHandler(this.trackBarVolume1_Scroll);
            // 
            // buttonPause1
            // 
            this.buttonPause1.Location = new System.Drawing.Point(300, 192);
            this.buttonPause1.Name = "buttonPause1";
            this.buttonPause1.Size = new System.Drawing.Size(64, 24);
            this.buttonPause1.TabIndex = 30;
            this.buttonPause1.Text = "Pause";
            this.buttonPause1.Click += new System.EventHandler(this.buttonPause1_Click);
            // 
            // buttonStop1
            // 
            this.buttonStop1.Location = new System.Drawing.Point(370, 192);
            this.buttonStop1.Name = "buttonStop1";
            this.buttonStop1.Size = new System.Drawing.Size(64, 24);
            this.buttonStop1.TabIndex = 29;
            this.buttonStop1.Text = "Stop";
            this.buttonStop1.Click += new System.EventHandler(this.buttonStop1_Click);
            // 
            // buttonPlay1
            // 
            this.buttonPlay1.Location = new System.Drawing.Point(230, 192);
            this.buttonPlay1.Name = "buttonPlay1";
            this.buttonPlay1.Size = new System.Drawing.Size(64, 24);
            this.buttonPlay1.TabIndex = 28;
            this.buttonPlay1.Text = "Play";
            this.buttonPlay1.Click += new System.EventHandler(this.buttonPlay1_Click);
            // 
            // labelVuMeter2
            // 
            this.labelVuMeter2.BackColor = System.Drawing.Color.Black;
            this.labelVuMeter2.Location = new System.Drawing.Point(70, 52);
            this.labelVuMeter2.Name = "labelVuMeter2";
            this.labelVuMeter2.Size = new System.Drawing.Size(40, 122);
            this.labelVuMeter2.TabIndex = 68;
            // 
            // buttonForward2
            // 
            this.buttonForward2.Location = new System.Drawing.Point(512, 177);
            this.buttonForward2.Name = "buttonForward2";
            this.buttonForward2.Size = new System.Drawing.Size(64, 24);
            this.buttonForward2.TabIndex = 56;
            this.buttonForward2.Text = "Forward";
            this.buttonForward2.Click += new System.EventHandler(this.buttonForward2_Click);
            // 
            // buttonRewind2
            // 
            this.buttonRewind2.Location = new System.Drawing.Point(440, 177);
            this.buttonRewind2.Name = "buttonRewind2";
            this.buttonRewind2.Size = new System.Drawing.Size(64, 24);
            this.buttonRewind2.TabIndex = 55;
            this.buttonRewind2.Text = "Rewind";
            this.buttonRewind2.Click += new System.EventHandler(this.buttonRewind2_Click);
            // 
            // label12
            // 
            this.label12.Location = new System.Drawing.Point(8, 28);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(48, 16);
            this.label12.TabIndex = 53;
            this.label12.Text = "Volume";
            this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // trackBarVolume2
            // 
            this.trackBarVolume2.Location = new System.Drawing.Point(8, 52);
            this.trackBarVolume2.Maximum = 100;
            this.trackBarVolume2.Name = "trackBarVolume2";
            this.trackBarVolume2.Orientation = System.Windows.Forms.Orientation.Vertical;
            this.trackBarVolume2.Size = new System.Drawing.Size(45, 122);
            this.trackBarVolume2.TabIndex = 52;
            this.trackBarVolume2.TickFrequency = 10;
            this.trackBarVolume2.TickStyle = System.Windows.Forms.TickStyle.Both;
            this.trackBarVolume2.Scroll += new System.EventHandler(this.trackBarVolume2_Scroll);
            // 
            // buttonPause2
            // 
            this.buttonPause2.Location = new System.Drawing.Point(300, 178);
            this.buttonPause2.Name = "buttonPause2";
            this.buttonPause2.Size = new System.Drawing.Size(64, 24);
            this.buttonPause2.TabIndex = 51;
            this.buttonPause2.Text = "Pause";
            this.buttonPause2.Click += new System.EventHandler(this.buttonPause2_Click);
            // 
            // buttonStop2
            // 
            this.buttonStop2.Location = new System.Drawing.Point(370, 177);
            this.buttonStop2.Name = "buttonStop2";
            this.buttonStop2.Size = new System.Drawing.Size(64, 24);
            this.buttonStop2.TabIndex = 50;
            this.buttonStop2.Text = "Stop";
            this.buttonStop2.Click += new System.EventHandler(this.buttonStop2_Click);
            // 
            // buttonPlay2
            // 
            this.buttonPlay2.Location = new System.Drawing.Point(230, 177);
            this.buttonPlay2.Name = "buttonPlay2";
            this.buttonPlay2.Size = new System.Drawing.Size(64, 24);
            this.buttonPlay2.TabIndex = 49;
            this.buttonPlay2.Text = "Play";
            this.buttonPlay2.Click += new System.EventHandler(this.buttonPlay2_Click);
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.labelPosition2);
            this.groupBox2.Controls.Add(this.buttonNext2);
            this.groupBox2.Controls.Add(this.buttonPrev2);
            this.groupBox2.Controls.Add(this.buttonMoveDown2);
            this.groupBox2.Controls.Add(this.buttonMoveUp2);
            this.groupBox2.Controls.Add(this.buttonRemove2);
            this.groupBox2.Controls.Add(this.buttonAddFile2);
            this.groupBox2.Controls.Add(this.buttonSave2);
            this.groupBox2.Controls.Add(this.buttonLoad2);
            this.groupBox2.Controls.Add(this.listViewPlaylist2);
            this.groupBox2.Controls.Add(this.labelVuMeter2);
            this.groupBox2.Controls.Add(this.buttonForward2);
            this.groupBox2.Controls.Add(this.buttonRewind2);
            this.groupBox2.Controls.Add(this.label12);
            this.groupBox2.Controls.Add(this.trackBarVolume2);
            this.groupBox2.Controls.Add(this.buttonPause2);
            this.groupBox2.Controls.Add(this.buttonStop2);
            this.groupBox2.Controls.Add(this.buttonPlay2);
            this.groupBox2.Location = new System.Drawing.Point(8, 236);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(648, 207);
            this.groupBox2.TabIndex = 4;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Playlist for Player 2";
            // 
            // labelPosition2
            // 
            this.labelPosition2.Location = new System.Drawing.Point(152, 177);
            this.labelPosition2.Name = "labelPosition2";
            this.labelPosition2.Size = new System.Drawing.Size(72, 16);
            this.labelPosition2.TabIndex = 87;
            this.labelPosition2.Text = "-";
            this.labelPosition2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // buttonNext2
            // 
            this.buttonNext2.Location = new System.Drawing.Point(618, 177);
            this.buttonNext2.Name = "buttonNext2";
            this.buttonNext2.Size = new System.Drawing.Size(24, 24);
            this.buttonNext2.TabIndex = 86;
            this.buttonNext2.Text = ">";
            this.buttonNext2.Click += new System.EventHandler(this.buttonNext2_Click);
            // 
            // buttonPrev2
            // 
            this.buttonPrev2.Location = new System.Drawing.Point(588, 177);
            this.buttonPrev2.Name = "buttonPrev2";
            this.buttonPrev2.Size = new System.Drawing.Size(24, 24);
            this.buttonPrev2.TabIndex = 85;
            this.buttonPrev2.Text = "<";
            this.buttonPrev2.Click += new System.EventHandler(this.buttonPrev2_Click);
            // 
            // buttonMoveDown2
            // 
            this.buttonMoveDown2.Location = new System.Drawing.Point(432, 16);
            this.buttonMoveDown2.Name = "buttonMoveDown2";
            this.buttonMoveDown2.Size = new System.Drawing.Size(72, 24);
            this.buttonMoveDown2.TabIndex = 75;
            this.buttonMoveDown2.Text = "Move down";
            this.buttonMoveDown2.Click += new System.EventHandler(this.buttonMoveDown2_Click);
            // 
            // buttonMoveUp2
            // 
            this.buttonMoveUp2.Location = new System.Drawing.Point(352, 16);
            this.buttonMoveUp2.Name = "buttonMoveUp2";
            this.buttonMoveUp2.Size = new System.Drawing.Size(72, 24);
            this.buttonMoveUp2.TabIndex = 74;
            this.buttonMoveUp2.Text = "Move up";
            this.buttonMoveUp2.Click += new System.EventHandler(this.buttonMoveUp2_Click);
            // 
            // buttonRemove2
            // 
            this.buttonRemove2.Location = new System.Drawing.Point(272, 16);
            this.buttonRemove2.Name = "buttonRemove2";
            this.buttonRemove2.Size = new System.Drawing.Size(72, 24);
            this.buttonRemove2.TabIndex = 73;
            this.buttonRemove2.Text = "Remove";
            this.buttonRemove2.Click += new System.EventHandler(this.buttonRemove2_Click);
            // 
            // buttonAddFile2
            // 
            this.buttonAddFile2.Location = new System.Drawing.Point(192, 16);
            this.buttonAddFile2.Name = "buttonAddFile2";
            this.buttonAddFile2.Size = new System.Drawing.Size(72, 24);
            this.buttonAddFile2.TabIndex = 72;
            this.buttonAddFile2.Text = "Add song";
            this.buttonAddFile2.Click += new System.EventHandler(this.buttonAddFile2_Click);
            // 
            // buttonSave2
            // 
            this.buttonSave2.Location = new System.Drawing.Point(512, 16);
            this.buttonSave2.Name = "buttonSave2";
            this.buttonSave2.Size = new System.Drawing.Size(72, 24);
            this.buttonSave2.TabIndex = 71;
            this.buttonSave2.Text = "Save";
            this.buttonSave2.Click += new System.EventHandler(this.buttonSave2_Click);
            // 
            // buttonLoad2
            // 
            this.buttonLoad2.Location = new System.Drawing.Point(112, 16);
            this.buttonLoad2.Name = "buttonLoad2";
            this.buttonLoad2.Size = new System.Drawing.Size(72, 24);
            this.buttonLoad2.TabIndex = 70;
            this.buttonLoad2.Text = "Load";
            this.buttonLoad2.Click += new System.EventHandler(this.buttonLoad2_Click);
            // 
            // listViewPlaylist2
            // 
            this.listViewPlaylist2.BackColor = System.Drawing.SystemColors.Window;
            this.listViewPlaylist2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnIndex2,
            this.columnDuration2,
            this.columnTitle2});
            this.listViewPlaylist2.FullRowSelect = true;
            this.listViewPlaylist2.GridLines = true;
            this.listViewPlaylist2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.listViewPlaylist2.HideSelection = false;
            this.listViewPlaylist2.Location = new System.Drawing.Point(230, 52);
            this.listViewPlaylist2.Name = "listViewPlaylist2";
            this.listViewPlaylist2.Size = new System.Drawing.Size(412, 120);
            this.listViewPlaylist2.TabIndex = 69;
            this.listViewPlaylist2.UseCompatibleStateImageBehavior = false;
            this.listViewPlaylist2.View = System.Windows.Forms.View.Details;
            // 
            // columnIndex2
            // 
            this.columnIndex2.Text = "Index";
            this.columnIndex2.Width = 38;
            // 
            // columnDuration2
            // 
            this.columnDuration2.Text = "Duration";
            this.columnDuration2.Width = 66;
            // 
            // columnTitle2
            // 
            this.columnTitle2.Text = "Title";
            this.columnTitle2.Width = 383;
            // 
            // timer1
            // 
            this.timer1.Enabled = true;
            this.timer1.SynchronizingObject = this;
            this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
            // 
            // audioDjStudio1
            // 
            this.audioDjStudio1.Fader = ((AudioDjStudio.FaderObject)(resources.GetObject("audioDjStudio1.Fader")));
            this.audioDjStudio1.LastError = AudioDjStudio.enumErrorCodes.NOERROR;
            this.audioDjStudio1.Location = new System.Drawing.Point(604, 458);
            this.audioDjStudio1.Name = "audioDjStudio1";
            this.audioDjStudio1.Size = new System.Drawing.Size(48, 48);
            this.audioDjStudio1.TabIndex = 5;
            this.audioDjStudio1.SoundLoaded += new AudioDjStudio.AudioDjStudio.SoundLoadedEventHandler(this.audioDjStudio1_SoundLoaded);
            this.audioDjStudio1.PlayListSoundLoadFailure += new AudioDjStudio.AudioDjStudio.SoundLoadedEventHandler(this.audioDjStudio1_PlayListSoundLoadFailure);
            this.audioDjStudio1.PlayListLoadStart += new AudioDjStudio.AudioDjStudio.PlayerEventHandler(this.audioDjStudio1_PlayListLoadStart);
            this.audioDjStudio1.PlayListLoadPerc += new AudioDjStudio.AudioDjStudio.PlayListLoadPercEventHandler(this.audioDjStudio1_PlayListLoadPerc);
            this.audioDjStudio1.PlayListLoadDone += new AudioDjStudio.AudioDjStudio.PlayListLoadDoneEventHandler(this.audioDjStudio1_PlayListLoadDone);
            // 
            // labelLoadingStatus
            // 
            this.labelLoadingStatus.Location = new System.Drawing.Point(5, 481);
            this.labelLoadingStatus.Name = "labelLoadingStatus";
            this.labelLoadingStatus.Size = new System.Drawing.Size(99, 16);
            this.labelLoadingStatus.TabIndex = 6;
            this.labelLoadingStatus.Text = "Loading ....";
            this.labelLoadingStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.labelLoadingStatus.Visible = false;
            // 
            // progressBarLoading
            // 
            this.progressBarLoading.Location = new System.Drawing.Point(110, 481);
            this.progressBarLoading.Name = "progressBarLoading";
            this.progressBarLoading.Size = new System.Drawing.Size(176, 16);
            this.progressBarLoading.TabIndex = 7;
            this.progressBarLoading.Visible = false;
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(664, 509);
            this.Controls.Add(this.progressBarLoading);
            this.Controls.Add(this.labelLoadingStatus);
            this.Controls.Add(this.audioDjStudio1);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "PlayLists sample";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarVolume1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.trackBarVolume2)).EndInit();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
            this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		

		private void Form1_Load(object sender, System.EventArgs e)
		{
			// verify presence of audio output devices
			Int32	nOutputs = audioDjStudio1.GetOutputDevicesCount();
			if (nOutputs == 0)
			{
				MessageBox.Show ("No output device detected and/or connected: the program will now close. If you are running under Windows Vista or higher, jack-sensing could disable an existing sound card if no speaker is physically connected so, if you are sure that a sound card is installed, try to plug a couple of speakers into the sound card before launching again this program.");
				Close ();
			}

			audioDjStudio1.InitSoundSystem (2, 0, 0, 0, 0, -1);

			audioDjStudio1.DisplayVUMeter.Create (Player_1, labelVuMeter1.Handle);
			audioDjStudio1.DisplayVUMeter.Show (Player_1, true);

			audioDjStudio1.DisplayVUMeter.Create (Player_2, labelVuMeter2.Handle);
			audioDjStudio1.DisplayVUMeter.Show (Player_2, true);

			trackBarVolume1.Value = 100;
			trackBarVolume2.Value = 100;

			// set playlists in loop mode
			audioDjStudio1.PlayListSetLoop (Player_1, true);
			audioDjStudio1.PlayListSetLoop (Player_2, true);

			// set a granularity of 5 seconds for forward/rewind operations on both players
			audioDjStudio1.ScaleUnits = enumScaleUnits.SCALE_SECONDS;
			audioDjStudio1.SetForwardRewindGranularity (Player_1, 5);
			audioDjStudio1.SetForwardRewindGranularity (Player_2, 5);
		}

		private void LoadPlayList (short nPlayer, ref ListView listViewPlaylist)
		{
			openFileDialog1.Filter = "Playlist formats (*.m3u;*.pls;*.wpl;*.pdj)|*.m3u;*.pls;*.wpl;*.pdj|M3U PlayList (*.m3u)|*.m3u|PLS PlayList (*.pls)|*.pls|WPL PlayList (*.wpl)|*.wpl|PDJ PlayList (*.pdj)|*.pdj|All files (*.*)|*.*";
			openFileDialog1.InitialDirectory = audioDjStudio1.SoundsDirectory;
			DialogResult result = openFileDialog1.ShowDialog ();
			if (result == DialogResult.Cancel)
				return;

			if (audioDjStudio1.PlayListLoadSync (nPlayer, openFileDialog1.FileName, enumPlayListModes.PLAYLIST_FULL_MODE) != enumErrorCodes.NOERROR)
			{
				MessageBox.Show ("Error loading playlist");
				return;
			}
		}

		private void SavePlayList (short nPlayer, ref ListView listViewPlaylist)
		{
			saveFileDialog1.Filter = "M3U PlayList (*.m3u)|*.m3u|PLS PlayList (*.pls)|*.pls|WPL PlayList (*.wpl)|*.wpl|PDJ PlayList (*.pdj)|*.pdj";
			saveFileDialog1.InitialDirectory = audioDjStudio1.SoundsDirectory;
			saveFileDialog1.FilterIndex = 3;
			DialogResult result = saveFileDialog1.ShowDialog ();
			if (result == DialogResult.Cancel)
				return;

			if (audioDjStudio1.PlayListSave (nPlayer, saveFileDialog1.FileName, (enumPlayListFormats)(saveFileDialog1.FilterIndex - 1)) != enumErrorCodes.NOERROR)
			{
				MessageBox.Show ("Error saving playlist");
				return;
			}
		}

		private void FillPlayListView (short nPlayer, ref ListView listViewPlaylist)
		{
			// empty list starting from the last item
			int	nCurrItems = listViewPlaylist.Items.Count;
			if (nCurrItems > 0)
			{
				for (int x = nCurrItems-1; x >= 0; x--)
					listViewPlaylist.Items.RemoveAt (x);
			}

			// fill list with playlist file contents
			short	nItemsCount = audioDjStudio1.PlayListGetCount (nPlayer);
			for (short i = 0; i < nItemsCount; i++)
			{
				string	strIndex = i.ToString  ();
				string	strDuration = audioDjStudio1.PlayListGetItemString (nPlayer, i, enumPlayListStrings.PL_STRING_INFO_FORMATTED_DURAT_NO_MS);
				string	strTitle = audioDjStudio1.PlayListGetItemString (nPlayer, i, enumPlayListStrings.PL_STRING_INFO_TITLE);
				if (strTitle.Length == 0)
					strTitle = audioDjStudio1.PlayListGetItemString (nPlayer, i, enumPlayListStrings.PL_STRING_FILENAME);

				string[]	listStrings = new string[] {strIndex, strDuration, strTitle};
				ListViewItem	item = new ListViewItem (listStrings, -1);
				listViewPlaylist.Items.Add (item);
			}
		}

		private void AddFileToPlayList (short nPlayer, ref ListView listViewPlaylist)
		{
			openFileDialog1.Filter =
				"Supported Sounds (*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" +
				"*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" +
				"*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" +
				"*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda)|" +
				"*.mp3;*.mp2;*.wav;*.ogg;*.aiff;*.wma;*.wmv;*.asx;*.asf;" +
				"*.m4a;*.mp4;*.flac;*.aac;*.ac3;*.wv;" +
				"*.au;*.aif;*.w64;*.voc;*.sf;*.paf;*.pvf;*.caf;*.svx ;" +
				"*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3;*.cda|" +
				"MP3 and MP2 sounds (*.mp3;*.mp2)|*.mp3;*.mp2|" +
				"AAC and MP4 sounds (*.aac;*.mp4)|*.aac;*.mp4|" +
				"WAV sounds (*.wav)|*.wav|" +
				"OGG Vorbis sounds (*.ogg)|*.ogg|" +
				"AIFF sounds (*.aiff)|*.aiff|" +
				"Windows Media sounds (*.wma;*.wmv;*.asx;*.asf)|*.wma;*.wmv;*.asx;*.asf|" +
				"AC3 sounds (*.ac3)|*.ac3;|" +
				"ALAC sounds (*.m4a)|*.ac3;|" +
				"FLAC sounds (*.flac)|*.flac;|" +
				"WavPack sounds (*.wv)|*.wv;|" +
				"MOD music (*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3)|*.it;*.xm;*.s3m;*.mod;*.mtm;*.mo3|" +
				"CD tracks (*.cda)|*.cda|" +
				"All files (*.*)|*.*";
			openFileDialog1.InitialDirectory = audioDjStudio1.SoundsDirectory;
			DialogResult	result = openFileDialog1.ShowDialog();
			if (result != DialogResult.OK)
				return;

			ListView.SelectedIndexCollection indexes = listViewPlaylist.SelectedIndices;
			short	nInsertPosition;
			if (indexes.Count > 0)
				nInsertPosition = (short) (indexes[indexes.Count-1] + 1);
			else
				nInsertPosition = (short) listViewPlaylist.Items.Count;

			audioDjStudio1.PlayListAddItem (nPlayer, openFileDialog1.FileName, nInsertPosition);

			// update the listview contents
			FillPlayListView (nPlayer, ref listViewPlaylist);
		}

		private void RemoveFileFromPlayList (short nPlayer, ref ListView listViewPlaylist)
		{
			ListView.SelectedIndexCollection indexes = listViewPlaylist.SelectedIndices;
			if (indexes.Count == 0)
				return;

			for (int i = (indexes.Count - 1); i >= 0; i--)
				audioDjStudio1.PlayListRemoveItem (nPlayer, (short) indexes[i]);

			// update the listview contents
			FillPlayListView (nPlayer, ref listViewPlaylist);
		}

		private void MovePlayListItem (short nPlayer, ref ListView listViewPlaylist, bool bMoveUp)
		{
			ListView.SelectedIndexCollection indexes = listViewPlaylist.SelectedIndices;
			if ((indexes.Count > 1) || (indexes.Count == 0))
				return;

			short	nCurSel = (short) indexes[0];
			if (bMoveUp && (nCurSel == 0))
			{
				listViewPlaylist.Select ();
				return;
			}

			if (!bMoveUp && (nCurSel == listViewPlaylist.Items.Count - 1))
			{
				listViewPlaylist.Select ();
				return;
			}

			if (bMoveUp)
				audioDjStudio1.PlayListMoveItem (nPlayer, nCurSel, (short)(nCurSel-1));
			else
				audioDjStudio1.PlayListMoveItem (nPlayer, nCurSel, (short)(nCurSel+1));

			// update the listview contents
			FillPlayListView (nPlayer, ref listViewPlaylist);

			if (bMoveUp)
				listViewPlaylist.Items[nCurSel-1].Selected = true;
			else
				listViewPlaylist.Items[nCurSel+1].Selected = true;
			listViewPlaylist.Select ();
		}

		private void PlayItem (short nPlayer, ref ListView listViewPlaylist)
		{
			ListView.SelectedIndexCollection indexes = listViewPlaylist.SelectedIndices;
			if ((indexes.Count > 1) || (indexes.Count == 0))
			{
				audioDjStudio1.PlayListExecute (nPlayer, true);
				return;
			}

			short	nCurSel = (short) indexes[0];
			audioDjStudio1.PlayListExecAt (nPlayer, nCurSel);
		}

		private void PlayPrevItem (short nPlayer, ref ListView listViewPlaylist)
		{
			audioDjStudio1.PlayListExecPrev (nPlayer);
		}

		private void PlayNextItem (short nPlayer, ref ListView listViewPlaylist)
		{
			audioDjStudio1.PlayListExecNext (nPlayer);
		}

		private void buttonLoad1_Click(object sender, System.EventArgs e)
		{
			LoadPlayList (Player_1, ref listViewPlaylist1);
		}

		private void buttonLoad2_Click(object sender, System.EventArgs e)
		{
			LoadPlayList (Player_2, ref listViewPlaylist2);		
		}

		private void buttonAddFile1_Click(object sender, System.EventArgs e)
		{
			AddFileToPlayList (Player_1, ref listViewPlaylist1);
		}

		private void buttonAddFile2_Click(object sender, System.EventArgs e)
		{
			AddFileToPlayList (Player_2, ref listViewPlaylist2);		
		}

		private void buttonRemove1_Click(object sender, System.EventArgs e)
		{
			RemoveFileFromPlayList (Player_1, ref listViewPlaylist1);
		}

		private void buttonRemove2_Click(object sender, System.EventArgs e)
		{
			RemoveFileFromPlayList (Player_2, ref listViewPlaylist2);
		}

		private void buttonMoveUp1_Click(object sender, System.EventArgs e)
		{
			MovePlayListItem (Player_1, ref listViewPlaylist1, true);
		}

		private void buttonMoveUp2_Click(object sender, System.EventArgs e)
		{
			MovePlayListItem (Player_2, ref listViewPlaylist2, true);
		}

		private void buttonMoveDown1_Click(object sender, System.EventArgs e)
		{
			MovePlayListItem (Player_1, ref listViewPlaylist1, false);
		}

		private void buttonMoveDown2_Click(object sender, System.EventArgs e)
		{
			MovePlayListItem (Player_2, ref listViewPlaylist2, false);
		}

		private void buttonPlay1_Click(object sender, System.EventArgs e)
		{
			PlayItem (Player_1, ref listViewPlaylist1);
		}

		private void buttonPlay2_Click(object sender, System.EventArgs e)
		{
			PlayItem (Player_2, ref listViewPlaylist2);	
		}

		private void buttonPrev1_Click(object sender, System.EventArgs e)
		{
			PlayPrevItem (Player_1, ref listViewPlaylist1);
		}

		private void buttonPrev2_Click(object sender, System.EventArgs e)
		{
			PlayPrevItem (Player_2, ref listViewPlaylist2);
		}

		private void buttonNext1_Click(object sender, System.EventArgs e)
		{
			PlayNextItem (Player_1, ref listViewPlaylist1);
		}

		private void buttonNext2_Click(object sender, System.EventArgs e)
		{
			PlayNextItem (Player_2, ref listViewPlaylist2);
		}

		private void audioDjStudio1_SoundLoaded(object sender, AudioDjStudio.SoundLoadedEventArgs e)
		{
			ListView	listView = null;
			switch (e.nPlayerIndex)
			{
				case 0: // Player_1
					listView = listViewPlaylist1;
					break;
				case 1: // Player_2
					listView = listViewPlaylist2;
					break;
				default:
					return;
			}
			// deselect all the selected items
			ListView.SelectedIndexCollection indexes = listView.SelectedIndices;
			foreach (int index in indexes)
				listView.Items[index].Selected = false;;

			// select the loaded item
			listView.Items[e.nItemIndex].Selected = true;
			listView.Items[e.nItemIndex].EnsureVisible ();
			listView.Select ();
		}

		private void buttonPause1_Click(object sender, System.EventArgs e)
		{
			enumPlayerStatus	nStatus = audioDjStudio1.GetPlayerStatus (Player_1);
			if (nStatus != enumPlayerStatus.SOUND_NONE)
			{
				if (nStatus == enumPlayerStatus.SOUND_PAUSED)
				{
					audioDjStudio1.ResumeSound (Player_1);		
					buttonPause1.Text = "Pause";
				}
				else
				{
					audioDjStudio1.PauseSound (Player_1);
					buttonPause1.Text = "Resume";
				}
			}
		}

		private void buttonPause2_Click(object sender, System.EventArgs e)
		{
			enumPlayerStatus	nStatus = audioDjStudio1.GetPlayerStatus (Player_2);
			if (nStatus != enumPlayerStatus.SOUND_NONE)
			{
				if (nStatus == enumPlayerStatus.SOUND_PAUSED)
				{
					audioDjStudio1.ResumeSound (Player_2);
					buttonPause2.Text = "Pause";
				}
				else
				{
					audioDjStudio1.PauseSound (Player_2);
					buttonPause2.Text = "Resume";
				}				
			}				
		}

		private void buttonStop1_Click(object sender, System.EventArgs e)
		{
			audioDjStudio1.StopSound (Player_1);		
		}

		private void buttonStop2_Click(object sender, System.EventArgs e)
		{
			audioDjStudio1.StopSound (Player_2);
		}

		private void buttonRewind1_Click(object sender, System.EventArgs e)
		{
			audioDjStudio1.RewindSound (Player_1);		
		}

		private void buttonRewind2_Click(object sender, System.EventArgs e)
		{
			audioDjStudio1.RewindSound (Player_2);
		}

		private void buttonForward1_Click(object sender, System.EventArgs e)
		{
			audioDjStudio1.ForwardSound (Player_1);
		}

		private void buttonForward2_Click(object sender, System.EventArgs e)
		{
			audioDjStudio1.ForwardSound (Player_2);
		}

		private void trackBarVolume1_Scroll(object sender, System.EventArgs e)
		{
			audioDjStudio1.StreamVolumeSet (Player_1, (short) trackBarVolume1.Value, enumVolumeScales.SCALE_LINEAR);
		}

		private void trackBarVolume2_Scroll(object sender, System.EventArgs e)
		{
			audioDjStudio1.StreamVolumeSet (Player_2, (short) trackBarVolume2.Value, enumVolumeScales.SCALE_LINEAR);
		}

		private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
		{
			audioDjStudio1.ScaleUnits = enumScaleUnits.SCALE_PERCENTAGE;

			short	nPerc = (short) audioDjStudio1.GetCurrentPos (Player_1);
			if (nPerc >= 0)
				labelPosition1.Text = nPerc.ToString () + "%";
			else
				labelPosition1.Text = "0%";

			nPerc = (short) audioDjStudio1.GetCurrentPos (Player_2);
			if (nPerc >= 0)
				labelPosition2.Text = nPerc.ToString () + "%";
			else
				labelPosition2.Text = "0%";
		
			audioDjStudio1.ScaleUnits = enumScaleUnits.SCALE_MILLISECONDS;
		}

		private void buttonSave1_Click(object sender, System.EventArgs e)
		{
			SavePlayList (Player_1, ref listViewPlaylist1);
		}

		private void buttonSave2_Click(object sender, System.EventArgs e)
		{
			SavePlayList (Player_2, ref listViewPlaylist2);
		}

		private void audioDjStudio1_PlayListSoundLoadFailure(object sender, AudioDjStudio.SoundLoadedEventArgs e)
		{
			// this event would be raised only with PlayListLoad method's mode
			// set to enumPlayListModes.PLAYLIST_SPEED_MODE
			Console.WriteLine ("Error loading item number {0} for player {1}", e.nItemIndex, e.nPlayerIndex);
		}

		private void audioDjStudio1_PlayListLoadStart(object sender, AudioDjStudio.PlayerEventArgs e)
		{
			labelLoadingStatus.Visible = true;
			progressBarLoading.Value = 0;
			progressBarLoading.Visible = true;
		}

		private void audioDjStudio1_PlayListLoadPerc(object sender, AudioDjStudio.PlayListLoadPercEventArgs e)
		{
			progressBarLoading.Value = e.nPercentage;
		}

		private void audioDjStudio1_PlayListLoadDone(object sender, AudioDjStudio.PlayListLoadDoneEventArgs e)
		{
			labelLoadingStatus.Visible = false;
			progressBarLoading.Visible = false;

			// check result
			if (e.bSuccess == false)
				MessageBox.Show ("Error loading playlist");
			else
			{
				if (e.nPlayerIndex == Player_1)
					FillPlayListView (Player_1, ref listViewPlaylist1);
				else
					FillPlayListView (Player_2, ref listViewPlaylist2);
			}
		}

        private void labelVuMeter1_Click(object sender, EventArgs e)
        {

        }



       

        private void listViewPlaylist1_ColumnClick(object sender,
                           System.Windows.Forms.ColumnClickEventArgs e)
        {
            

            // Determine whether the column is the same as the last column clicked.
            if (e.Column != sortColumn)
            {
                // Set the sort column to the new column.
                sortColumn = e.Column;
                // Set the sort order to ascending by default.
                listViewPlaylist1.Sorting = SortOrder.Ascending;
            }
            else
            {
                // Determine what the last sort order was and change it.
                if (listViewPlaylist1.Sorting == SortOrder.Ascending)
                    listViewPlaylist1.Sorting = SortOrder.Descending;
                else
                    listViewPlaylist1.Sorting = SortOrder.Ascending;
            }

            // Call the sort method to manually sort.
            listViewPlaylist1.Sort();
            // Set the ListViewItemSorter property to a new ListViewItemComparer
            // object. tania
          //  this.listViewPlaylist1.ListViewItemSorter = new ListViewItemComparer(e.Column,
          //                                                   listViewPlaylist1.Sorting);
        }

        
	}

